The "Bar button" is an easy way for the HyperCard author to ask for numeric values. It is an XCMD which works a bit like a scroll bar, but you can choose the height, width and direction the bar moves. You may also specify the range of acceptable values (more on that later.)
Over to the right are two simple Bar buttons. When you click inside a button, the cursor changes to a thin cross, and the bar moves up to the cursor. When you release the mouse button, the "value" of the cursor position is returned in "the result".
Note that the two buttons' scripts are identical, even though one bar moves bottom to top and the other left to right. The Bar button automatically operates bottom to top if the button's rectangle is taller than it is wide.
Try changing the size or shape of the buttons. They can be any size, even the whole width of the screen.
If you include at least two parameters,BarButton will normally display the current numeric value as you change the size of the bar. The value is always displayed to the right of left&right Bar buttons, and below the up&down Bar buttons.
You can issue the "BarButton" command at any time; you're not limited to just when a user clicks in the button.
You may optionally include up to four parameters after the BarButton command.
The first parameter tells the XCMD to operate the bar in a particular direction:
1: left to right
2: right to left
3: bottom to top
4: top to bottom
Using the negatives of these numbers will suppress the numeric value display when specifying the second and third parameters.
The second and third parameters after the BarButton command tell the XCMD the range of values you allow. The second parameter is the maximum, and the third is the minimum. If the third parameter is absent, zero is assumed. All values must be integers.
The fourth parameter is used when you wish to force an initial value without requiring that the user click in the button. When you supply this fourth parameter, BarButton displays the initial value and immediately returns, without even looking at the mouse location.